package com.shidaimanong.mapper;

import com.shidaimanong.entity.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 学编程，关注：十代码农
 * 抖音、快手、B站、西瓜视频、今日头条
 */
@Repository
public interface UserMapper {
    @Select(value = "select * from user where id = #{id}")
    User queryUser(@Param("id") int id);

    @Select(value = "select * from user")
    List<User> queryAllUsers();

    @Insert(value = "insert into user values (#{id}, #{userName})")
    void addUser(@Param("id") int id, @Param("userName") String userName);


    @Update(value = "update user set userName=#{userName} where id = #{id}")
    void modifyUser(@Param("id") int id, @Param("userName") String userName);

    @Delete("delete from user where id = #{id}")
    void delUser(@Param("id") int id);
}
